<?php
	require_once($_SERVER['DOCUMENT_ROOT'].'uno-course-scheduler/include/config.inc.php');
	require_once($_SERVER['DOCUMENT_ROOT'].'uno-course-scheduler/include/top.inc.php');

$classroom_id = mysql_real_escape_string(strip_tags($_GET['cid']));


$get_building_data = mysql_query("SELECT * FROM buildings b JOIN classrooms c ON c.building_id = b.id WHERE c.id = $classroom_id");
$building_id = mysql_result($get_building_data,0,'building_id');
$building_name = mysql_result($get_building_data,0,'building_name');
$abbreviation = mysql_result($get_building_data,0,'abbreviation');

$get_classroom_data = mysql_query("SELECT * FROM classrooms WHERE id = $classroom_id");
$room_num = mysql_result($get_classroom_data,0,'room_num');

$get_days = mysql_query("SELECT * FROM days");
$num_days = mysql_numrows($get_days);

echo "<p>";
	echo "<a href='index.php?bid=$building_id&id=$classroom_id'>&lt;&lt; Back to Closings Portal</a><br />";
echo "</p>";
echo "<h1>Add Classroom Closing in $abbreviation $room_num</h1>";

echo "<p>Please enter time in 24 hour, HH:MM:SS format (i.e. 17:30:00)</p>";

$i=0;

echo "<form action='add_do.php' method='post'>";

//start table
echo "<table border='0'>";
	
	//create table row with column ID's
	echo "<tr>";
		echo "<td width='80' style='text-align: center'><b>Day</b></td>";
		echo "<td width='80' style='text-align: center'><b>Start Time</b></td>";
		echo "<td width='80' style='text-align: center'><b>End Time</b></td>";
	echo "</tr>";
	
	echo "<tr>";
		echo "<td width='80' style='text-align: center'>";
			echo "<select name='day'>";
				while ($i < $num_days)
				{
					$day_name=mysql_result($get_days,$i,"day_name");
					$day_id=mysql_result($get_days,$i,"id");
					echo "<option value=$day_id>$day_name</option>";
					$i++;
				}
			echo "</select>";		
		echo "</td>";
		
		echo "<td width='80' style='text-align: center'><input type='text' name='start'></td>";
		echo "<td width='80' style='text-align: center'><input type='text' name='end'></td>";
	echo "</tr>";


//end table tag
echo "</table>";

echo "<input type='hidden' name='cid' value='$classroom_id'>";
echo "<p><input type='submit'></p>";
echo '</form>';


?>

<?php
	require_once($_SERVER['DOCUMENT_ROOT'].'uno-course-scheduler/include/bottom.inc.php');
?>